//package com.xiaoxu.intranetweb.mybatisplusSzappdb.controller.webSocket;
//
//import com.xiaoxu.intranetweb.mybatisplusSzappdb.dto.MessageDto;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.messaging.handler.annotation.Header;
//import org.springframework.messaging.handler.annotation.MessageMapping;
//import org.springframework.messaging.handler.annotation.Payload;
//
//import org.springframework.messaging.simp.SimpMessagingTemplate;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.CrossOrigin;
//
//@Controller
////跨域
////@CrossOrigin(origins = "*", maxAge = 3600)
//public class MesssageController {
//    @Autowired
//    private SimpMessagingTemplate messagingTemplate;
////    点对点发消息
//    @MessageMapping("/send") // 客户端发送消息的目的地，需要与前端代码中一致
//    public void send( @Payload MessageDto message,@Header(value = "Authorization",required = false) String token) {
////            messagingTemplate.convertAndSendToUser(message.getTargetUser(), "/messsage/receive", message);
////        消息表，消息表有一个字段是消息状态，已读未读，发送消息的时候，消息状态为未读
////        发送消息并且检验消息是否发送成功
////        发给用户之前校验一下是否存在这个用户
//        messagingTemplate.convertAndSendToUser(message.getTargetUser(), "/message/receive", message);
//    }
//    public void send2(MessageDto message){
//        messagingTemplate.convertAndSendToUser(message.getTargetUser(), "/message/receive", message);
//    }
//}